package com.zh.rent.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zh.rent.dao.AccountDao;
import com.zh.rent.pojo.Account;
import com.zh.rent.service.AccountService;
import io.lettuce.core.dynamic.annotation.Param;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

@Service
@Transactional(isolation = Isolation.READ_COMMITTED)
public class AccountServiceImpl  implements AccountService {
    @Autowired
    AccountDao accountDao;
    @Override
    public int insertaccountsAll(List<Account> list) {
        return accountDao.insertaccountsAll(list);
    }

    @Override
    public int insertaccounts(Account account) {
        return accountDao.insertaccounts(account);
    }

    @Override
    public PageInfo<Map<String, Object>> selaccountAll(Integer pageNum,Integer pageSeiz, Map<String,Object> map){
        PageHelper.startPage(pageNum,pageSeiz);
        List<Map<String, Object>> list = accountDao.selaccountAll(map);
        return new PageInfo<>(list);
    }

    @Override
    public int updateaccount(Account account) {
        return accountDao.updateaccount(account);
    }

    @Override
    public int delAccBccAll(List<Integer> list) {
        return accountDao.delAccBccAll(list);
    }

    @Override
    public int delAccBccid(Integer Accountid) {
        return accountDao.delAccBccid(Accountid);
    }

    @Override
    public int updateInvCount(Integer Invcount, Integer Accountid) {
        return accountDao.updateInvCount(Invcount,Accountid);
    }

    @Override
    public String selType(Integer Accountid) {
        return accountDao.selType(Accountid);
    }

    @Override
    public Map<String, Integer> accDissel(List<Integer> list,Integer InvitationDays,Double BuyMoney) {
        return accountDao.accDissel(list,InvitationDays,BuyMoney);
    }

    @Override
    public int updateAccDis(Integer Accountid) {
        return accountDao.updateAccDis(Accountid);
    }

    @Override
    public Account selAcc(Integer Accountid) {
        return accountDao.selAcc(Accountid);
    }

    @Override
    public int updateStan(Integer Standbyid, Integer Accountid) {
        return accountDao.updateStan(Standbyid, Accountid);
    }

    @Override
    public List<Account> selAccAll() {
        return accountDao.selAccAll();
    }

    @Override
    public List<Account> selStanAid(Integer Standbyid) {
        return accountDao.selStanAid(Standbyid);
    }


}
